/*
 * @Author: Wxx
 * @Date: 2022-02-22 10:49:05
 * @LastEditors: Wxx
 * @LastEditTime: 2022-02-22 10:53:36
 * @Description:
 */
import React, { Component } from "react";
import MSwiper from "./../swiper/Swiper";
import SwiperItem from "../swiper/SwiperItem";
import axios from "axios";

export default class App extends Component {
  state = {
    list: [],
  };
  componentDidMount() {
    axios({
      url: "https://m.maizuo.com/gateway?type=2&cityId=440100&k=1039999",
      headers: {
        "X-Client-Info":
          '{"a":"3000","ch":"1002","v":"5.2.0","e":"16454281163713789501374465","bc":"440100"}',
        "X-Host": " mall.cfg.common-banner",
      },
    }).then((res) => {
      this.setState({
        list: res.data.data,
      });
    });
  }
  render() {
    return (
      <div>
        <MSwiper>
          {this.state.list.map((item) => (
            <SwiperItem key={item.bannerId}>
              <img
                src={item.imgUrl}
                alt={item.name}
                style={{ width: "100%" }}
              />
            </SwiperItem>
          ))}
        </MSwiper>
      </div>
    );
  }
}
